import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_learn_vi/src/bean/bean_mine.dart';
import 'package:flutter_learn_vi/src/page/catalogue/catalogue_main_page.dart';

/// 创建人： Created by zhaolong
/// 创建时间：Created by  on 2020/12/11.
///
/// 可关注公众号：我的大前端生涯   获取最新技术分享
/// 可关注网易云课堂：https://study.163.com/instructor/1021406098.htm
/// 可关注博客：https://blog.csdn.net/zl18603543572
///
/// 代码清单
///代码清单
class BlocDetailsPage extends StatefulWidget {
  final MineBean mineBean;

  BlocDetailsPage({@required this.mineBean});

  @override
  _BlocDetailsPageState createState() => _BlocDetailsPageState();
}

class _BlocDetailsPageState extends State<BlocDetailsPage>
    with SingleTickerProviderStateMixin {
  TabController _tabController;

  @override
  void initState() {
    super.initState();
    _tabController = new TabController(vsync: this, length: 2);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      ///填充布局
      body: NestedScrollView(
        headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
          return [
            SliverAppBar(
              expandedHeight: 44,
              title: Text("${widget.mineBean.name}"),
              centerTitle: true,
              pinned: true,
              elevation: 0,
              bottom: TabBar(
                controller: _tabController,
                indicatorSize: TabBarIndicatorSize.label,
                tabs: [
                  Tab(
                    text: "新闻资讯",
                  ),
                  Tab(
                    text: "党的建设",
                  )
                ],
              ),
            ),
          ];
        },
        body: TabBarView(
          physics: NeverScrollableScrollPhysics(),
          controller: _tabController,
          children: [
            CatalogueMainPage(2, mineBean: widget.mineBean),
            CatalogueMainPage(1, mineBean: widget.mineBean),
          ],
        ),
      ),
    );
  }
}
